package com.kingwang.training.designpattern.visitor.deep.step1;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

/**
 * 指挥官
 *
 * @author King
 */
public class Commander {
    private List<Soldier> army = new ArrayList<>();

    public Commander(Collection<Soldier> army) {
        this.army.addAll(army);
    }

    /**
     * 指挥官指挥部队攻击
     */
    public void attack() {
        for (Soldier soldier : this.army) {
            soldier.attack();
        }
    }
}
